package cn.dankal.flyaudio.adapter;

import android.view.View;
import android.view.ViewGroup;

import com.jeremyliao.liveeventbus.LiveEventBus;

import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewAdapter;
import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewHolder;
import cn.dankal.basiclib.pojo.CouponEntity;
import cn.dankal.flyaudio.R;
import cn.dankal.flyaudio.configs.LiveDataBusConstant;
import cn.dankal.flyaudio.friend.utils.takevideo.utils.LogUtils;

/**
 * <pre>
 *     e-mail : junfeng.nie@duntech.com.cn
 *     time   : 15/7/2020
 *     desc   :
 *     version: cn.dankal.flyaudio.adapter
 *     Copyright: Copyright（c）2018
 *     Company:
 * </pre>
 *
 * @author niejunfeng
 */
public class SelectCardAdapter extends BaseRecyclerViewAdapter<CouponEntity> {
    @Override
    protected int getLayoutResId(int viewType) {
        return R.layout.item_select_card;
    }

    @Override
    protected BaseRecyclerViewHolder getViewHolder(ViewGroup parent, View rootView, int viewType) {
        return new SelectCardAdapter.ViewHolder(rootView);
    }

    public class ViewHolder extends BaseRecyclerViewHolder<CouponEntity> {

        public ViewHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void onBindData(CouponEntity data, int position) {
            setText(R.id.item_tv_name, data.getName());
//            setText(R.id.item_tv_prompt, data.getUsedDatetime());
            LogUtils.e(data.getName());
            setText(R.id.item_tv_time, data.getExpireDatetime());
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    LiveEventBus.get(LiveDataBusConstant.PICK_COUPON_RESULT, CouponEntity.class).post(data);
                }
            });
        }
    }

    private void send(){

    }
}

